home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1987 December
/
1987-12.d64
/
word find
(
.txt
)
< prev
Wrap
Commodore BASIC
|
2022-09-20
|
4KB
|
109 lines
10 rem copyright 1987 compute! publications, inc. - all rights reserved
20 xr=781:yr=782:sr=783:bo=53280:ba=bo+1:q=12
30 ndx=198:ifpeek(65530)=5then(NULL)15:xr=7:yr=8:sr=5:ndx=208
40 ifpeek(65530)=164thensr=2037:xr=2035:yr=2036:bo=65305:ba=65301:q=14:ndx=239
50 pl=65520:pokebo,0:pokeba,0
60 ifpeek(65530)<>164thens=54272:forn=stos+24:poken,0:next
70 al$="qazxswedcvfrtgbnhyujmkiolp"
80 print"[147][156] copyright 1987 compute! pub., inc."
90 printtab(10)"all rights reserved":gosub840
100 print""tab(15)"word find"
110 input"would you like a time limit (y/n)";tl$
120 iftl$<>"y"andtl$<>"n"then120
130 iftl$="n"thentl$="200000":tl=0:goto170
140 input"how many minutes (1-59)";tl:iftl<1ortl>59then140
145 if tl<>int(tl) then 140
150 tl=int(tl):tl$=str$(tl*100):tl$=right$(tl$,len(tl$)-1):tl=1
160 forww=1to6-len(tl$):tt$=tt$+"0":next:tl$=tt$+tl$
170 gosub770:gosub680:gosub620:gosub460:gosub420
180 rem - main loop -
190 ti$="000000":tu=0:wf=0
200 pokeyr,27:pokexr,1:syspl:input"[159]row ";ro$:ro=val(ro$)
210 ifro<1thenbs=0:goto240
220 ifro>20thenbs=1:goto240
230 gosub1060:goto250
240 pokeyr,27:pokexr,1:syspl:print"too ";bs$(bs):gosub1070:gosub1060:goto200
250 ifti$>tl$thentu=1:goto890
260 pokeyr,27:pokexr,1:syspl:input"column ";co$:co=val(co$)
270 ifco<1thenbs=0:goto300
280 ifco>20thenbs=1:goto300
290 gosub1060:goto310
300 pokeyr,27:pokexr,1:syspl:print"too ";bs$(bs):gosub1070:gosub1060:goto250
310 f=0:fori=1tonw:ifro<>py(i)orco<>px(i)then330
320 f=2:ift(i)=0thenx1=i:t(i)=1:f=1:i=nw
330 next:iff=1then360
340 c$="wrong":iff=2thenc$="that's found"
350 pokeyr,27:pokexr,1:pokesr,0:syspl:printc$:gosub1070:gosub1060:goto200
360 fori=0tolen(w$(x1))-1:xp=3+px(x1)+i*dx(tw(x1))
370 yp=2+py(x1)+i*dy(tw(x1)):gosub960
380 print"[156]"mid$(w$(x1),i+1,1):gosub1030
390 next:pokeyr,25:pokexr,2+x1:syspl:printw$(x1):wf=wf+1:ifwf=nwthen880
400 goto200
410 rem - fill grid -
420 fory=1to20:forx=1to20
430 ifa$(x,y)=""thena$(x,y)=mid$(al$,26*rnd(1)+1,1)
440 xp=3+x:yp=2+y:gosub960:printa$(x,y):next:next:return
450 rem - position words -
460 pw=0
470 pw=pw+1
480 px(pw)=int(20*rnd(1)+1):py(pw)=int(20*rnd(1)+1)
490 dr=int(8*rnd(1)+1):tw(pw)=dr
500 cx=px(pw)+len(w$(pw))*dx(dr):cy=py(pw)+len(w$(pw))*dy(dr)
510 ifcx<1orcx>20orcy<1orcy>20then480
520 f=0:forck=0tolen(w$(pw))-1
530 z1$=mid$(w$(pw),ck+1,1):z2$=a$(px(pw)+ck*dx(dr),py(pw)+ck*dy(dr))
540 ifz2$<>""andz1$<>z2$thenf=1
550 next:iff=1then480
560 forck=0tolen(w$(pw))-1
570 z1$=mid$(w$(pw),ck+1,1):a$(px(pw)+ck*dx(dr),py(pw)+ck*dy(dr))=z1$
580 xp=25:yp=2+pw:gosub960:printw$(pw);:next
590 ifpw=nwthenreturn
600 goto470
610 rem - sort by length -
620 pokeyr,29:pokexr,1:syspl:print"sorting"
630 f=0:fori=1tonw-1
640 iflen(w$(i))<len(w$(i+1))thent$=w$(i+1):w$(i+1)=w$(i):w$(i)=t$:f=1
650 next:iff=1then630
660 gosub1060:return
670 rem - print grid -
680 print"[147]";
690 print"[172]";:fori=1to20:print"[162]";:next
700 print"[187][157]";:fori=1to20:print"[161][146][157]";:next
710 print"[190][157][157]";:fori=1to20:print"[146][162][157][157]";:next
720 print"[188][157][145]";:fori=1to20:print"[146][161][157][145]";:next:print""
730 fori=1to20:nu$=str$(i):nu$=mid$(nu$,2):iflen(nu$)=1thennu$=" "+nu$
740 xp=1:yp=i+2:gosub960:printnu$:xp=i+3:yp=0:gosub960:printleft$(nu$,1)
750 xp=i+3:yp=1:gosub960:printright$(nu$,1):next:return
760 rem - input words -
770 input"[147]how many words (maximum of 20)";nw:print:ifnw<1ornw>20then770
780 print"[147]enter each word between 3 and"q
790 print"characters in length:":fori=1tonw
800 printi"> ";:inputw$(i)
810 iflen(w$(i))<3orlen(w$(i))>qthenprintchr$(13)"[145][145][145]":goto800
820 next:return
830 rem - set up variables -
840 dima$(20,20),w$(20),px(20),py(20),dx(8),dy(8),tw(20),t(20)
850 fori=1to8:readdx(i),dy(i):next:bs$(0)="small ":bs$(1)="big ":return
860 data 0,-1,1,-1,1,0,1,1,0,1,-1,1,-1,0,-1,-1
870 rem - subroutines -
880 gosub1070:gosub970
890 forx1=1tonw:fori=0tolen(w$(x1))-1
900 xp=3+px(x1)+i*dx(tw(x1)):yp=2+py(x1)+i*dy(tw(x1)):gosub960:print"";
910 printmid$(w$(x1),i+1,1)
920 gosub1030
930 next:xp=25:yp=2+x1:gosub960:printw$(x1):next
940 pokendx,0:forps=1to5000:next
950 print"[147]"tab(7)"you didn't finish in time.":goto990
960 pokesr,0:pokeyr,xp:pokexr,yp:syspl:return
970 print"[147]":xp=14:yp=12:gosub960:print"you did it!!"
980 iftl=1thenprint"[149] and you finished in time!"
990 xp=6:yp=17:gosub960:print"press space bar[146] to play again"
1000 geta$:ifa$=" "thenrun
1010 ifa$<>""thenprint"[147]":end
1020 goto1000
1030 ifpeek(65530)=164then(NULL)7:(NULL)3,1000,5:return
1040 pokes+5,64:pokes+6,0:pokes+24,15:pokes+1,100:pokes,0:pokes+4,129
1050 forn=1to22:next:pokes+4,0:return
1060 pokesr,0:pokeyr,27:pokexr,1:syspl:print" ":return
1070 fori=1to1000:next:return